import Qt 4.7

Rectangle {
    id: sideMenu

    width: 118; height: 314
    color: "transparent"

    signal add
    signal cashFlow
    signal categories
    signal targets

    SideMenuButton {
        id: addButton

        fixedX: 21; x: 21; y: 16
        text: "Adicionar"
        icon: "../resources/pixmaps/Menu/Adicionar.png"
    }

    SideMenuButton {
        id: cashFlowButton

        fixedX: 21; x: 21; y: 89
        text: "Caixa"
        icon: "../resources/pixmaps/Menu/Caixa.png"
    }

    SideMenuButton {
        id: categoriesButton

        fixedX: 21; x: 21; y: 162
        text: "Categorias"
        icon: "../resources/pixmaps/Menu/Categorias.png"
    }

    SideMenuButton {
        id: targetsButton

        fixedX: 21; x: 21; y: 236
        text: "Metas"
        icon: "../resources/pixmaps/Menu/Metas.png"
    }

    MouseArea {
        id: mouseArea

        anchors.fill: parent

        onPositionChanged: {
            if(mouse.y < 15) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 15 && mouse.y < 68) {
                addButton.state = 'hoverEntered'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 88 && mouse.y < 151) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverEntered'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 161 && mouse.y < 223) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverEntered'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 235 && mouse.y < 297) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverEntered'
            } else if(mouse.y > 297) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            }
        }

        onPressed: {
            if(mouse.y < 15) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 15 && mouse.y < 68) {
                addButton.state = 'hoverEntered'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 88 && mouse.y < 151) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverEntered'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 161 && mouse.y < 223) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverEntered'
                targetsButton.state = 'hoverExited'
            } else if(mouse.y > 235 && mouse.y < 297) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverEntered'
            } else if(mouse.y > 297) {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            }
        }

        onReleased: {
            if(mouse.y > 15 && mouse.y < 68) {
                sideMenu.add()
                addButton.state = 'hoverExited'
            } else if(mouse.y > 88 && mouse.y < 151) {
                sideMenu.cashFlow()
                cashFlowButton.state = 'hoverExited'
            } else if(mouse.y > 161 && mouse.y < 223) {
                sideMenu.categories()
                categoriesButton.state = 'hoverExited'
            } else if(mouse.y > 235 && mouse.y < 297) {
                sideMenu.targets()
                targetsButton.state = 'hoverExited'
            } else {
                addButton.state = 'hoverExited'
                cashFlowButton.state = 'hoverExited'
                categoriesButton.state = 'hoverExited'
                targetsButton.state = 'hoverExited'
            }
        }
    }
}
